Event After Show
OnActivate event
Form OnActivate event is fired every time if form gets focus. Also this event is fired after OnShow event. Then it is possible to use this event to executed code only once after OnShow event. Boolean variable is needed so after form shown code will be executed only once.
1 | type |
Send custom message
It is possible to define custom message and send it to application message queue so it will be handled as soon as possible.
1 | uses |
QueueAsyncCall
There is a way how to execute asynchronous operations in Lazarus using Asynchronous Calls. This is useful mainly for parallel processing but it can be used also for execution of form after show handler.
1 |
|
TTimer
You can use TTimer instance for delayed execution of startup code. Create instance of TTimer component and set its property Enabled to False and Interval to 1. Then from the end of FormShow handler enable timer manually. It will be executed as soon as possible. You need to disable timer at the start of timer handler.
1 | procedure TFormMain.FormShow(Sender: TObject);QueueAsyncCall |
참조
https://wiki.freepascal.org/Execute_action_after_form_is_shown